﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PlainOldVersionControl.IViews.Base;
using PlainOldVersionControl.ErrorHandling;
using PlainOldVersionControl.BusinessLogic.Base;

namespace PlainOldVersionControl.UI
{
    public partial class ViewCommit : Form, ICommit
    {
        private string CHash { get; set; }

        public ViewCommit(string commitHash)
        {
            InitializeComponent();
            CHash = commitHash;
        }

        private void ViewCommit_Load(object sender, EventArgs e)
        {
            try
            {
                CommitBL.ViewCommit(CHash, this as ICommit);
            }
            catch (Exception ex)
            {
                ErrorHandlingHelper.HandleError(ex);
            }
        }

        #region ICommit Members

        public string Hash
        {
            set { lblCommit.Text = string.Format("Commit:{0}", value); }
        }

        public string Author
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                lblInfo.Text += string.Format(" Author:{0} ", value);
            }
        }

        public string Message
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                txtMessage.Text += value;
            }
        }

        public DateTime CreatedDate
        {
            set { lblInfo.Text += string.Format(" Date:{0} ", value); }
        }

        public string TreeHash
        {
            set { throw new NotImplementedException(); }
        }

        public string ParentCommit
        {
            set { throw new NotImplementedException(); }
        }

        #endregion
    }
}
